home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
007a
/
899track.zip
/
899PRINT.PRO
< prev
next >
Wrap
Text File
|
1990-03-06
|
6KB
|
180 lines
project "899"
include "899glob.pro"
% 899PRINT.PRO -- Printing module (for labels and sheets)
% USES window #61
% Global Predicates in this file...
% sheet_print
% label_print
DATABASE - printbase
determ linesPrinted(INTEGER) % Number of lines printed
determ linesPerPage(INTEGER) % Lines per page
determ printComments % Boolean
determ fullListPrint % Boolean (Used with catsToPrint)
determ catsToPrint(gsList) % Categories to print (If not fullListPrint)
determ labelprint % Boolean
PREDICATES
set_s_options % sheet_print options
set_l_options % label_print options
print_engine
check_for_print(gsList) % non determ
findmatch(gsList,gsList)
selectCats
page_eject(INTEGER)
label_check(INTEGER)
stop_check
CLAUSES
sheet_print :-
makewindow(61,green,green," Printing ",6,0,18,79),
set_s_options,
clearwindow,
write("About to print list of record labels...position paper\n"),
wait,
clearwindow,
write("Press any key to stop printing...."),
writedevice(printer),
print_engine,
flush(printer),
writedevice(screen),
retractall(_,printbase),
removewindow.
label_print :-
makewindow(61,green,green," Label Printing ",6,0,18,79),
set_l_options,
clearwindow,
write("Position labels in printer (1 accross)...\n"),
wait,
clearwindow,
write("Press any key to stop printing...."),
writedevice(printer),
print_engine,
flush(printer),
writedevice(screen),
retractall(_,printbase),
removewindow.
set_s_options :-
assert(linesPrinted(0),printbase),
assert(linesPerPage(66),printbase),
assert(printComments,printbase),
assert(catsToPrint([]),printbase),
selectCats, !.
set_l_options :-
assert(labelprint,printbase),
assert(catsToPrint([]),printbase),
selectCats, !.
selectCats :-
write("Do you want ALL categories of music printed (Y/N)? "),
not(askyn), !,
getMusicTypes(AllTypes),
Tit = "Use Cursors,\17\217 to select category for printing ",
getbacktrack(Btop),
repeat,
catsToPrint(CurrL),
clearwindow,
write("Current categories selected for printing --\n"),
writelist(CurrL,5),
show_get(AllTypes,MoreCats,Tit),
NewList = [MoreCats|CurrL],
retract(catsToPrint(_),printbase),
assert(catsToPrint(NewList),printbase),
write("New List is --\n"),
writelist(NewList,5),
write("Add more categories to print (Y/N)? "),
not(askyn),
cutbacktrack(Btop).
selectCats :-
retract(catsToPrint(_),printbase), !,
assert(fullListPrint,printbase). % And do this for ESC from above
print_engine :-
labelprint,
write("\027M\027x\001"), % Condesed print, letter quality
label(Cats,Lab,Addr,City,State,Zip,_,_), % For Each label
check_for_print(Cats),
write(Lab,'\n'),
writelist(Addr,0),
write(City,", ",State," ",Zip,'\n'),
listlen(Addr,Acount),
label_check(Acount),
stop_check,
fail.
print_engine :-
not(labelprint),
write('\012'), % Page eject
label(Cats,Lab,Addr,City,State,Zip,Phone,Comments), % For Each label
check_for_print(Cats),
listlen(Addr,Acount), % Get the number of things to print here
listlen(Comments,Ccount),
listlen(Cats,Catcount),
Tcount = Acount + Ccount + Catcount + 6,
page_eject(Tcount),
write(Lab," ",Phone), nl,
writelist(Addr,0),
write(City,", ",State,' ',Zip), nl,
write(" CATEGORIES::\n"),
writelist(Cats,7),
write(" COMMENTS::\n"),
writelist(Comments,7), nl, nl,
stop_check,
fail.
print_engine :- write("\012\027@"). % Page eject, reset printer
check_for_print(_) :- % Succeds if full list is to be printed
fullListPrint, !.
check_for_print(Cats) :- % Above failed -- test for subset
catsToPrint(ListToPrint), % Get this
findmatch(Cats,ListToPrint).
findmatch([],_) :- !, fail. % Such is what happens at ent of test list
findmatch([X|_],ListToPrint) :-
sameMusicCategory(X,ListToPrint), !. % Succeds here, if 1 is in list
findmatch([_|Rest],ListToPrint) :-
findmatch(Rest,ListToPrint). % Try the rest of the list if fails -- not there
page_eject(LinesToPrint) :-
linesPrinted(Lprinted), % Get how many done
linesPerPage(MaxLines), % Get the maximum number of lines per page
NewTotal = LinesToPrint + Lprinted,
NewTotal > MaxLines, !,
write('\012'), % Eject the page if so
retract(linesPrinted(Lprinted),printbase), !, % Take old count out
assert(linesPrinted(LinesToPrint),printbase). % A new page
page_eject(LinesToPrint) :- % No page eject is neccesary
retract(linesPrinted(OldTotal),printbase), !,
NewTotal = OldTotal + LinesToPrint,
assert(linesPrinted(NewTotal),printbase).
label_check(0) :- !,
write("\n\n\n\n").
label_check(1) :- !,
write("\n\n\n").
label_check(2) :- !,
write("\n\n").
label_check(_) :-
write("\n").
stop_check :-
keypressed, !, % A key was pressed....
inkey(_), !, % Discard the keystroke
writedevice(screen),
clearwindow,
write("Would you like to abort the current print job (Y/N)? "),
askyn, !,
retractall(_,printbase), !,
assert(catsToPrint([]),printbase),
fail.
stop_check :- writedevice(printer).